﻿Public Class FormSetting
    Dim DATimeSetting As New DSReservationTableAdapters.TIME_SETTINGTableAdapter
    Private Sub BtnNewPriceHours_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNewPriceHours.Click
        Dim FNewTimeSetting As New NewTimeSetting
        If FNewTimeSetting.ShowDialog() = Windows.Forms.DialogResult.OK Then
            RefreshTimeSetting()
        End If
    End Sub
    Private Sub RefreshTimeSetting()
        GridTimeSetting.DataSource = DATimeSetting.GetData
    End Sub

    Private Sub FormSetting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RefreshTimeSetting()
    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        If GridTimeSetting.SelectedItems.Count = 0 Then Exit Sub
        Dim FNewTimeSetting As New NewTimeSetting
        FNewTimeSetting.LblSaveOption.Text = GridTimeSetting.GetRow.Cells("TIME_ID").Value
        FNewTimeSetting.TxtDurationStay.Text = GridTimeSetting.GetRow.Cells("TIME_DESCRIPTION").Value
        FNewTimeSetting.txtHoursStay.Text = GridTimeSetting.GetRow.Cells("VALUE").Value
        FNewTimeSetting.TxtDurationPrice.Text = GridTimeSetting.GetRow.Cells("PRICE").Value
        If FNewTimeSetting.ShowDialog() = Windows.Forms.DialogResult.OK Then
            RefreshTimeSetting()
        End If
    End Sub
End Class